package com.xmut.mall.product.controller;

import com.xmut.mall.product.annotation.CheckJwt;
import com.xmut.mall.product.service.TradeService;
import com.xmut.mall.product.utils.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 交易Controller
 */
@RestController
@RequestMapping("/product/trude")
public class TradeController {
    @Autowired
    private TradeService tradeService;

    /**
     * 交易详情
     * @param params
     * @return
     */
    @CheckJwt
    @PostMapping("/tradeDetail")
    public RespBean tradeDetail(@RequestBody Map<String,Object> params){
        return tradeService.tradeDetail(params);
    }

    /**
     * 根据map参数创建交易订单
     * @param params
     * @return
     */
    @CheckJwt
    @PostMapping("/createTrade")
    public RespBean createTrade(@RequestBody Map<String,Object> params){
        return tradeService.createTrade(params);
    }
}
